package GraphTheoryTools;
import processing.core.PApplet;
import changceilingcolor003.*;
public class CircleFlowAlgorithm implements FlowAlgorithm {

	
	ChangCeilingColor003 m_parent = null;
	void FlowAlgorithm(ChangCeilingColor003 parent)
	{
		m_parent = parent;
	}
	 
	
	
	@Override
	public boolean reflow(DirectedGraph g) {
		 float interval = 2*PApplet.PI / (float)g.size();
		    int cx = m_parent.width/2;
		    int cy = m_parent.height/2;
		    float vl = cx - (2*g.getNode(0).r1) - 10;
		    for(int a=0; a<g.size(); a++)
		    {
		      int[] nc = SupportFunction.rotateCoordinate(vl, 0, (float)a*interval);
		      g.getNode(a).x = cx+nc[0];
		      g.getNode(a).y = cy+nc[1];
		    }
		    return true;
	}

}
